package com.itboye.mengwu.data.presenter;

import java.util.List;
import java.util.Observer;

import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.object.BasePresenter;
import com.itboye.core.object.ResultEntity;
import com.itboye.mengwu.app.ui.main.MainPresenter;
import com.itboye.mengwu.data.interfaces.IMyComments;
import com.itboye.mengwu.data.model.MyCommentsModel;
import com.itboye.mengwu.data.repository.MyCommentsRepository;

public class MyCommentsPresenter extends BasePresenter implements IMyComments<MyCommentsModel>{

	public static final String MyComments_success = MainPresenter.class
			.getName() + "_MyComments_success";
	public static final String MyCommentsFailEvent = MainPresenter.class
			.getName() + "_MyComments_fail";
	
	public MyCommentsPresenter(Observer observer) {
		super(observer);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void add(MyCommentsModel model) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void delete(MyCommentsModel model) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void update(MyCommentsModel model) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void getInfo(MyCommentsModel model) {
		// TODO Auto-generated method stub
		IMyComments<MyCommentsModel> iMyComments = new MyCommentsRepository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(MyComments_success);
						MyCommentsPresenter.this.setChanged();
						MyCommentsPresenter.this.notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Error);
						result.setEventType(MyCommentsFailEvent);
						MyCommentsPresenter.this.setChanged();
						MyCommentsPresenter.this.notifyObservers(result);
					}
				});

		iMyComments.getInfo(model);
		
	}

	@Override
	public List<MyCommentsModel> queryYouHuiQuan(MyCommentsModel model) {
		// TODO Auto-generated method stub
		return null;
	}

}
